home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 38
/
Amiga Format CD38 (1999-03-15)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-04].iso
/
-seriously_amiga-
/
misc
/
football
/
exec
/
viewcupresults.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-02-03
|
4KB
|
133 lines
/* ***********************************************************************
CUP RESULTS PROGRAM FOR FOOTBALL REXX SUITE
---------------------------------------------
Copyright Mark Naughton 1997
Version Date History
--------------------------------------------------------------------------
1.0 011197 First release.
151297 Added routine to improve on the round names. Tidied
display. Improved method that read the file and
formatted it - smaller.
260898 Amended bettername() for 1 or 2 legs.
**************************************************************************
Procedure
---------
1. Check files exist.
2. Open file and print all lines without '*' with the exception of
the league name which is underlined; possibly dates as well.
3. Also reformat "*Round" from the file into a more readable look.
3. Close file and exit.
************************************************************************** */
ARG league_file
version = 1
league_file = "Data/" || league_file
input_file = '.scf'
separator = '*'
if exists(league_file || input_file) = 0 then exit
if open(datafile,league_file || input_file,'r') then do
say
say center("Display Cup Results...(and matches to be played)",78)
say
say center("for",78)
say
do while ~eof(datafile)
line = readln(datafile)
if pos(separator,line) = 0 then
say line
else do
if pos("**",line) > 0 then do
parse var line "** "cupname
say center(cupname,78)
say "-------------------------------------------------------------------------------"
end
else do
if pos("*Round=",line) > 0 then do
if pos("Leg",line) > 0 then do
k = pos(" Leg",line)
roundname = bettername(substr(line,8,5),substr(line,k-1,6))
end
else
roundname = bettername(substr(line,8,5),"Blank")
say
say trim(roundname)
uline = ''
do i=1 to length(trim(roundname))
uline = insert('-',uline,i,1)
end
say strip(uline)
end
end
end
end
say "-------------------------------------------------------------------------------"
close(datafile)
end
else do
say
say "ERROR : (ViewCupResults)"
say
say "Cannot open '"league_file||input_file"' for reading."
end
exit
/* Routine ----------------------------------------------------------- */
bettername:
parse arg crn,legless
trdn = substr(crn,1,1)
if datatype(trdn,'n') = 1 then do
if pos("Replay",crn) > 0 then
trn = strip(word(crn,1))" Round "strip(word(crn,2))
else do
parse var crn roundno" "extra
trn = strip(crn)" Round "extra
end
end
else do
if pos("Final",crn) > 0 then do
parse var crn . " "extra
if pos("Replay",crn) > 0 then
trn = "Final "extra
else
trn = "Final"
end
if pos("Semi",crn) > 0 then do
parse var crn . " "extra
if pos("Replay",crn) > 0 then
trn = "Semi-Final "extra
else
trn = "Semi-Finals"
end
if pos("Quart",crn) > 0 then do
parse var crn . " "extra
if pos("Replay",crn) > 0 then
trn = "Quarter-Final "extra
else
trn = "Quarter-Finals"
end
if pos("Third",crn) > 0 then do
trn = "Third Place Play-Off"
end
end
if pos("1 Leg",legless) > 0 then
trn = trn||" (1st Leg)"
if pos("2 Legs",legless) > 0 then
trn = trn||" (2nd Leg)"
return trn
/* ------------------------------------------------------------------- */